suppressPackageStartupMessages(library("plotly"))
suppressPackageStartupMessages(library("ggplot2"))
set.seed(1234)
pd <- diamonds[sample(1:nrow(diamonds), size = 10000), ]
p <- ggplot(pd, aes(x = carat, y = price, col = color)) +
geom_point() +
geom_smooth()
p <- ggplotly(p)
## Warning: We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
## `geom_smooth()` using method = 'gam'
p